Hi everyone !
string output // string containing the content of the xml file
string outputBase64Encoded // string containing the content of the xml file, encoded base 64
// Base64 encoding (necessary to store into Sharepoint)
toBase64_ (output, outputBase64Encoded)
// Sharepoint server address definition
string local_path_site = "http://sharepoint.portal.int/PATH_TO_STORE_THE_FILE/"
string wsdl = "_vti_bin/copy.asmx"
string action = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems" // soap request used for this task : CopyIntoItems
// Creation of the HTTP request object
OleAutoObj xhr = oleCreateAutoObject "MSXML2.XMLHTTP"
OleAutoArgs objArg = create
// Opening an HTTP POST request
clear objArg
put(objArg, "bstrMethod", "POST")
put(objArg, "bstrUrl", local_path_site wsdl)
put(objArg, "varAsync", false)
put(objArg, "bstrUser", "USERNAME")
put(objArg, "bstrPassword", "PASSWORD")
string result1 = oleMethod(xhr, "Open", objArg)
// Sending the first header request
clear objArg
put(objArg, "bstrHeader", "Content-Type")
put(objArg, "bstrValue", "text/xml; charset=utf-8")
string result2 = oleMethod(xhr, "setRequestHeader", objArg)
// Sending the second header request
clear objArg
put(objArg, "bstrHeader", "SOAPAction")
put(objArg, "bstrValue", action)
string result3 = oleMethod(xhr, "setRequestHeader", objArg)
// Concatenation of the soap request CopyIntoItems
string soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:m=\"http://schemas.microsoft.com/sharepoint/soap/\">
<soap:Header></soap:Header>
<soap:Body>
<m:CopyIntoItems>
<m:SourceUrl>C:\\temp\\output.xml</m:SourceUrl> // Path where the xml file is currently stored
<m:DestinationUrls>
<m:string>http://sharepoint.portal.int/PATH_TO_STORE_THE_FILE/output.xml</m:string> // Path on the sharepoint server where I want the xml file to be stored
</m:DestinationUrls>
<m:Fields></m:Fields>
<m:Stream>" outputBase64Encoded "</m:Stream> // Here I indicate the base64 encoded file content
</m:CopyIntoItems>
</soap:Body>
</soap:Envelope>"
// Sending the soap request
clear objArg
put(objArg, soap)
string result4 = oleMethod(xhr, "Send", objArg)
My questions are:
Thanks in advance for any kind of help !
laydgeur - Tue Jan 17 11:04:37 EST 2017 |
Re: Error while sending xml file to Sharepoint server with 64bits computers Can you give the exact errors you get and the line of code? This code is hard to try, if you do not have the right setup. Additionally can you post the following info:
Regards, Mathias |
Re: Error while sending xml file to Sharepoint server with 64bits computers Mathias Mamsch - Wed Jan 18 03:56:28 EST 2017 Can you give the exact errors you get and the line of code? This code is hard to try, if you do not have the right setup. Additionally can you post the following info:
Regards, Mathias Hi Mathias and thank you for your feedback !
I will gather the information you suggested and post it hereafter. |